// alert("Good morning!")

function IE_varTest(){
    var sname = "张三"
    var sage = 24
    var sIsMarried = false
    var sChild = null
    // var sIsListen = undefined
    console.log("姓名:" + sname + "年龄:" + sage + "<br>")
    document.write(sname + "是否已婚" + sIsMarried)
    document.write(sChild)
}

function varTest1(){
    var a = 10;
    var b = 20;
    var c = a++ + ++a + a++;
    d = 10;
    var e = --d + d++ + --d + d++;
    alert("a:" + a + " " + "c:" + c + " " +  "d:" + d + " " + "e:" + e);

}

function varTest2(){
    var a = 10
    var b = "20"
    var c = true
    var d = a + b
    var e = a + c
    alert(d + " " +  e)
}

function isRefuse(){
    var age = document.getElementById('age').value
    if(age>=18){
        alert('Come in please!')
    }else{
        alert('Go out!')
    }
}

function isScoresatisfy(){
    var score = document.getElementById('score').value
    if(score>0 && score<60){
        alert('揍一顿')
    }else if(score>=60 &&score<70){
        alert('骂一顿')
    }else if(score>=70 &&score<80){
        alert('将就吧')
    }else if(score>=80 &&score<90){
        alert('还不错')
    }else if(score>90 &&score<=100){
        alert('♥奖励♥')
    }
}

function showPrice(){
    var oilType = document.getElementById('oilType').value
    var num = document.getElementById('num').value
    var totalPrice
    if(oilType == '#92'){
        if(num>30){
            totalPrice = 8.5 * num
            alert('Price:' + totalPrice)
        }else{
            totalPrice = 9 * num
            alert('Price:' + totalPrice)
        }
    }else if(oilType == '#95'){
        if(num>30){
            totalPrice = 9.5 * num
            alert('Price:' + totalPrice)
        }else{
            totalPrice = 10 * num
            alert('Price:' + totalPrice)
        }
    }
    
}

function isRunnian(){
    var year = document.getElementById('year').value
    if(year%400 == 0 || year%4 == 0){
        alert('是闰年')
    }
    else{
        alert('不是闰年')
    }
}

function isScore(){
    var score = document.getElementById('Sscore').value
    if(score>89 && score<=100){
        alert('A')
    }else if(score>=80 && score<90){
        alert('B')
    }else if(score>=70 && score<80){
        alert('C')
    }else if(score>=60 && score<70){
        alert('D')
    }else if(score>=0 && score<60){
        alert('E')
    }
}

// function showBiggest(){
//     var a = prompt('请输入第1个数')
//     var b = prompt('请输入第2个数')
//     var c = prompt('请输入第3个数')
//     var d
    
// }

function choiceTest(){
    var testNumber = parseInt(prompt('请输入数字'))

    switch(testNumber){
        case 1:
            alert("content1")
            break
        case 2:
            alert("content2")
            break
        case 3:
            alert("content3")
            break
        case 3:
            alert("content4")
            break
        default:
            alert("No info!")
            break
    }
}


//循环嵌套
function sum(){
    var result = 0
    for(var i = 1; i<=100; i++){
        result = result + i
    }
    alert(result)
}

function forInfor(){
    for(let i = 0; i<5; i++){
        for(let j = 0; j<5; j++){
            document.write('* ')
        }
        document.write("<br>")
        
    }
}

function show99(){
    for(let i = 1; i<=9; i++){
        for(let j = 1; j<=i; j++){
            let result = i * j
            document.write(j + "*" + i + "=" + result + " ") 
        }
        document.write("<br>")
    }
    
}

function squireShow(){
    for(let i = 1; i<5; i++){

        for(let tmp = 1; tmp<=(4 - i); tmp++){
            document.write("&nbsp")
        }

        for(let j = 1; j<=(2*i - 1); j++){
            document.write("*")  
        }
        document.write("<br>")
    }
}

function  getThebigger(){
    var a = parseInt(prompt("The first number:"))
    var b = parseInt(prompt("The second number:"))
    if(a > b){
        alert(a)
    }else{
        alert(b)
    }
}

//数组
function arrTest1(){
    var arr = [1,2,3,4,5,6]
    var arr1 = new Array(6,5,4,3,2,1)
    var arr2 = new Array(5)

    //访问数组元素
    // console.log(arr[1])
    // console.log(arr[0])

    for(let i = 0; i<6; i++){
        console.log(arr[i] + " ")
    }
    for(let i = 0; i<6; i++){
        console.log(arr1[i] + " ")
    }
    for(let i = 0; i<5; i++){
        console.log(arr2[i] + " ")
    }
    console.log(arr.join(""))
}